<?php
include '../config.php';
include DIR_FUNCTIONS . 'dt_admin_functions.php';

//classes
include DIR_CLASSES . 'database.class.php';

$dbClass = new Database();
$dbClass->connect();

$username = stripslashes(mysql_real_escape_string($_POST['username']));
$password = stripslashes(mysql_real_escape_string($_POST['password']));
$pass = md5($password);

$query = "SELECT * FROM dt_users WHERE username = '$username' AND password = '$pass'";
$data = mysql_query($query);

$count = mysql_num_rows($data);

//echo $pass;
if($count == 1)
{
    while ($row = mysql_fetch_array($data)) {
        session_start();
        $_SESSION['username'] = $row['username'];
    }
    header("Location: index.php");
} else { header("Location: login.php"); }

?>
